/**
 * Created by jean.h.ma on 19/03/2018.
 */
import update from 'immutability-helper'

const initialState = {
	showSlideMenu: true
};

const ACTION_TOGGLE_SLIDE_MENU = Symbol();

export function toggleSlideMenu(value: Boolean) {
	return {
		type: ACTION_TOGGLE_SLIDE_MENU,
		payload: value
	};
}

export default function (state = initialState, action = {}) {
	switch (action.type) {
		case ACTION_TOGGLE_SLIDE_MENU:
			return update(state, {
				showSlideMenu: {$set: action.payload}
			});
		default:
			return state;
	}
}